package com.hjh.netty.elect.demo3;

import org.springframework.context.ApplicationListener;
import org.springframework.context.event.ContextRefreshedEvent;
import org.springframework.stereotype.Component;

@Component
public class StartSeverApplicationListenerListener implements ApplicationListener<ContextRefreshedEvent> {

    @Override
    public void onApplicationEvent(ContextRefreshedEvent contextRefreshedEvent) {

        SocketServer socketServer = contextRefreshedEvent.getApplicationContext().getBean(SocketServer.class);
        socketServer.start();

    }
}
